UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TuceyxgOkLIdj3AA1Z2pZC5tfPyUdVITtHowHlcKfqI='
WHERE
key_id = '7f9398f9f8ef28ac883e54a182e0084deacfa44f2568849ec03b3e5abee823a8'
AND (
token = 'TuceyxgOkLIdj3AA1Z2pZC5tfPyUdVITtHowHlcKfqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)