UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gQsiBaGuCcIG6CaQakaelnbzQ+fWgTl6OEqsbI0JaZQ='
WHERE
key_id = 'ebbd5bac36af5ff28119dc69978bbe53a7ffb4790755a93ef5e9ea73074213c4'
AND (
token = 'gQsiBaGuCcIG6CaQakaelnbzQ+fWgTl6OEqsbI0JaZQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)