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