UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GA3yHksUTlkXrGGEZf8B4YtWdxf8d3ufod3yYR51V9s='
WHERE
key_id = '1a50651c53bad9f67043eba69b83a7a57c8537969a302fc5f01e28e9eed4a468'
AND (
token = 'GA3yHksUTlkXrGGEZf8B4YtWdxf8d3ufod3yYR51V9s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)