UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ni95YTVtZomxplWBKkO46qvd1lPAkHxFM4rv9Z6JJg4='
WHERE
key_id = '85ab0b7df740c0bfd415fc931a63ee766b238beebf0d5685c6fad8f8f6a81007'
AND (
token = 'Ni95YTVtZomxplWBKkO46qvd1lPAkHxFM4rv9Z6JJg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)