UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NRxCpgUw7q62Zy3MH/a0Dkvp67kAse6kwfJ7abasx+k='
WHERE
key_id = '76b926ab956c0661764b448d9f165bfdc2fd78768e8e7495631523c2463536f0'
AND (
token = 'NRxCpgUw7q62Zy3MH/a0Dkvp67kAse6kwfJ7abasx+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)