UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cXBPWokkmLsCCeZR5maCttpImrnPB4VvvGoN3IljutM='
WHERE
key_id = '6ff9a7d7947b1f54d38aabe6e30e3976e7b59ea5c9c322ad9a8496f5b441551a'
AND (
token = 'cXBPWokkmLsCCeZR5maCttpImrnPB4VvvGoN3IljutM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)