UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'riDRrGPTXLUwgsFVEpiN78cZ6S9w0oYeC5AZW9x/Wso='
WHERE
key_id = 'c9d20ac789c40eefc3b74c026ae9cffd21dde3b0e56d4ff6cd3149263db33f1d'
AND (
token = 'riDRrGPTXLUwgsFVEpiN78cZ6S9w0oYeC5AZW9x/Wso='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)