UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/8zFnmt52ftYy7iWW9BMmQ1VJhguvBA2IBMfCwH/NU=' 
WHERE 
  key_id = '588a78b1683bd58797d7467c20a15ec237bb22cfd0f0a81007f8cce1fc9a93be' 
  AND (
    token = 'g/8zFnmt52ftYy7iWW9BMmQ1VJhguvBA2IBMfCwH/NU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017