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