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