UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9QZFhFCoeByYsq4adpT232YqmurIHf/4iV5tRLHz79k='
WHERE
key_id = 'b6e1afdfc191069b352c750e95d0c8bebebffe22391a78898a14523df12500fa'
AND (
token = '9QZFhFCoeByYsq4adpT232YqmurIHf/4iV5tRLHz79k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)