UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cndAW2c9s+y0iC0xIjOVAZ3/d2BjjA1pY6PE6aPnfEY='
WHERE
key_id = 'e1735cb53a087889ec655e64fdfe3a76bc0f302f695f29ac550affab4f78bab1'
AND (
token = 'cndAW2c9s+y0iC0xIjOVAZ3/d2BjjA1pY6PE6aPnfEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)