How do changes to your speed that occur on your own turn affect your available movement?

After seeing this Q/A on whether releasing a grappled creature increases your available movement, I am wondering a more general question.

Under “Your Turn” it states:

On your turn, you can move a distance up to your speed…

I also noticed that the Dash action specifically states:

Any increase or decrease to your speed changes this additional movement by the same amount…

But I am still unsure; how do changes to your speed which occur on your own turn, such as ray of frost, releasing a grapple, or longstrider, affect your available movement for that turn?

For example, if you have 30 speed and movement, and you use 10 movement and then longstrider is cast on you, do you now have 30 movement left or 20?
If you have 30 speed and movement, and you use 10 movement and then ray of frost is cast on you, do you now have 20 movement left or 10?

My other question here is not a duplicate because it did not specify that the changes to your movement were occurring on your own turn (the current answer there assumed they were not on your own turn)