UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7OPs6FpWdgwh+1Yu8kmc7nQ3YceV8OWE4T0nAVGz/I=' 
WHERE 
  key_id = '568a60f85dc408369c5c40a854d7acba18f43a0126aede606ac64b4bddd4d19d' 
  AND (
    token = 'J7OPs6FpWdgwh+1Yu8kmc7nQ3YceV8OWE4T0nAVGz/I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033