UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hklWjQWRnMGaTo/rpvGqzFB8ZWD4oAIW4AyCt8hsRYs='
WHERE
key_id = '51b7f8db0248e950e03bd7957451329279bbf6a319a5653ceca0d8307e2e2330'
AND (
token = 'hklWjQWRnMGaTo/rpvGqzFB8ZWD4oAIW4AyCt8hsRYs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)