UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2mfgcpmrAf4ABpWKbSApLqcQ53IirrpL7GH3bPZ8Izo='
WHERE
key_id = '3dc64415cd2f333f8279b0e3f9c430ca4d54c91ad29e749c5496446f0d3b8c77'
AND (
token = '2mfgcpmrAf4ABpWKbSApLqcQ53IirrpL7GH3bPZ8Izo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)