UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cxg8vy7u99eqhrQtxIQVWoNgI0rigq+4qMozeEnyC9Q='
WHERE
key_id = 'b4f9c041501b67b351e74fa56e8b5fc8d31341a118a96cfbeb18756257f69cc3'
AND (
token = 'Cxg8vy7u99eqhrQtxIQVWoNgI0rigq+4qMozeEnyC9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)