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