UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Z0AEIRjrqPL/37CMAIlr6qgoO268RrL+s4HE03pgig='
WHERE
key_id = '1b90e2d638399f3c6d4a1faa4171f7c7f3a6caca4c444648df8f7ee944fe771f'
AND (
token = '9Z0AEIRjrqPL/37CMAIlr6qgoO268RrL+s4HE03pgig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)