This is quite a common problem. As guitars get old the machine heads can seize up. Any oil in them dries out and if it’s been exposed to any moisture, they can rust inside. Also the plastic of the key gets brittle, consequently they end up snapping off or breaking in two.
The easiest way to repair it is to just replace them with new ones. If you have something very old and rare then maybe you would want to repair the vintage heads, but that’s another story. Since there is nothing special about this one I’m just going to change them. Sadly you can’t buy just one, they come in sets of 6. It does make matching them up a little easier… The ones I’ve found were about £20.
At least they fit the existing holes so don’t look out-of-place. It’s always worth dropping some very fine oil in the small holes on the back now and again, keep things moving.
A bit of a spit and polish and job done..