Variable goes very high in update method

Hello all. So basically I’m working on a thing and based of a score variable, I want my speed variable to increase. However, the variable goes very high in the for loop. I assume this is because it is in the update method which checks it very quickly so it goes high up. Is there a way to make not have this happen?
Here is the code:

  void Update()
  {
    int[] levelNums = { 5, 10, 20, 30, 40, 50 };

    for (int i = 0; i < 6; i++)
    {
        if (score == levelNums*)*

{
speed+= 5;
}
}
~Thanks in advance.

i think you need to add 1 more varible to stop speed for incrementing,

public bool leveled;
 
void Update()
   {
     int[] levelNums = { 5, 10, 20, 30, 40, 50 };
     for (int i = 0; i < 6; i++)
     {
         if (score == levelNums *&& leveled==false)*

{
if(leveled==true){leveled=false;}
else{speed+= 5;
leveled = true;}
}
}