UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ts8g89bCNsK7jPEpolOAqRDVlYqOPxGep1ckWGQykxM='
WHERE
key_id = '003c0772aea91c512afe9f3f1cc4d915f47b22fad01fc5122d08122f9cc2ae93'
AND (
token = 'ts8g89bCNsK7jPEpolOAqRDVlYqOPxGep1ckWGQykxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)