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