UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g9jjMCe+6fjNlEWRIu+6yyQpVnKTp1wLIe3I1AH9DOE='
WHERE
key_id = '940706e258b193ecd3ba4ca0ad46a76065798ffeda0717e3967e17db66895ef5'
AND (
token = 'g9jjMCe+6fjNlEWRIu+6yyQpVnKTp1wLIe3I1AH9DOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)