UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wc8TiIiNP+0NHA4vjxmpkKbwKIyKGpC27Jzmk/fC1fg=' 
WHERE 
  key_id = '10181f0f2978e29f40c60d727e94ace784f7727bd84a6efd398d18ace1569600' 
  AND (
    token = 'Wc8TiIiNP+0NHA4vjxmpkKbwKIyKGpC27Jzmk/fC1fg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032