UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oap1PZAXmktLBwqzA3N7zI7tCSKmYL3On9J9iQN7ppc='
WHERE
key_id = 'be9d23a4d88579a4aeaadd117ebf79764bb83260b572a276e3d85acb51c09cbe'
AND (
token = 'oap1PZAXmktLBwqzA3N7zI7tCSKmYL3On9J9iQN7ppc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)