UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VZqYSL2/LRCLjJWW345P7cmrRSNKIDc/Ivl/GU3Zrz4='
WHERE
key_id = 'd67e4cd0a83d9829067b19202140d272c811daf6b0e2ac0111bfcef9b33aaedc'
AND (
token = 'VZqYSL2/LRCLjJWW345P7cmrRSNKIDc/Ivl/GU3Zrz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)