UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pwdijBYDtX0aRKpc0/y5rfpu3bQzBtMCE3y3kL76Z34='
WHERE
key_id = '6c81002fc99fd53183ccba76ebf7fe9b1f122d59d8270e261f7b408387fb6a88'
AND (
token = 'pwdijBYDtX0aRKpc0/y5rfpu3bQzBtMCE3y3kL76Z34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)