UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IVJ8lBTKK40wgJacJSAED17LV1NsSiCRm4rpJT7bREM='
WHERE
key_id = 'f55199bc7b0e9ccf0ca5cb94fdc35d101bd26b21c89beba903e5501088217e37'
AND (
token = 'IVJ8lBTKK40wgJacJSAED17LV1NsSiCRm4rpJT7bREM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)