Your guitar strings have the least longevity of all your guitar parts.
The 6th and 5th (heaviest) strings are, for all practical purposes, never affected structurally. Early learners tend to have a problem keeping the 1st (and 2nd) string(s) intact for long as they tend to play more in these parts.
But, overall, the 3rd, and sometimes, the 4th strings are the most affected.
Buy spares and replace them as and when they break.
You do not need to replace the entire set, if you aren't going to be playing on stage.
Once a new string is fitted, it begins to stretch under the tension and "gives way" for a first few days losing its tune frequently.
There's nothing wrong with your keys in that case. Just retune and keep playing. It will get better in a day or two.
Moving the guitar in and out of hot and cold environments (AC rooms) will alter its tune as the guitar strings will either expand or contract according to the change in temperature.
This is especially bothersome in the winter months when a tune you set in the morning is ruined in the evening and vice versa. Again, it’s not a problem of the keys. Just retune and it'll be fine.
A guitar string needs to be replaced, even when it is not broken, if the spun coils on the core string get broken separately. This will make a bad buzzing sound and wreck your guitars sound.
Liked 'Reasons why guitar strings are so troublesome' enough to share / save?