UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8Ki0Mw3giU3TGmH/18hXaRXB2tgtb23bCmYtcFLbFxk='
WHERE
key_id = '2a07546cf411349cfd8200d5b3a8f43ea4d88bd3c0397c155567516ea5b18462'
AND (
token = '8Ki0Mw3giU3TGmH/18hXaRXB2tgtb23bCmYtcFLbFxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)