UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uSI3Dcod50Trc9+5pfmazdLB+r0FK/4N8J+U5Yp5Q3w='
WHERE
key_id = 'cd6663811431c3dd60a0add99bbe17ed8294305a3a4613e95c42967f64dcaa12'
AND (
token = 'uSI3Dcod50Trc9+5pfmazdLB+r0FK/4N8J+U5Yp5Q3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)