UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8SoHnHF5zlXZldW/Cfn8rWaFTA0c7J1pHFXW+HWgghI='
WHERE
key_id = '1e015d855e370f97c273ee62ef1a34bfe2cc5dc46163e586e631c3c606590d2e'
AND (
token = '8SoHnHF5zlXZldW/Cfn8rWaFTA0c7J1pHFXW+HWgghI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)