UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fo5rdlRDXjz1uEKqZRh7Mg7C04yTNoZVGLf2EqnvOgU=' 
WHERE 
  key_id = '371d394ac6fccc15c4a5bfb094bda18b565cdce2359d381afc3bc1d05e651b3f' 
  AND (
    token = 'fo5rdlRDXjz1uEKqZRh7Mg7C04yTNoZVGLf2EqnvOgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031