UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HZQJqr/TmqrU+bwdmpL7vCh8syx/tWWzK9d+y3f6x9Q='
WHERE
key_id = 'f8a659e0e9c96edef38a01e8aafc851a95d2217c836facc73bca754329b4edc8'
AND (
token = 'HZQJqr/TmqrU+bwdmpL7vCh8syx/tWWzK9d+y3f6x9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)