Technology is improving as time goes on. Besides age, a keyboard that is played everyday is going to wear down faster.
It’s best to find keyboards with 88 weighted keys. I had a few second-hand keyboards before. They lasted between 3-5 years. Some models are no longer in the market made by Roland or Yamaha but are very playable. You might even look at used stage pianos. They’re higher quality keyboards for stage performances.
Besides buying second-hand, you can ask the store to sell you a display model for less. Try to get the stand, 3-pedal unit & bench thrown in. At least you get an almost new instrument.
The 2 important things are the touch of the keys and a good piano sound. An older keyboard you are less likely going to get a natural piano sound. The touch is quit subjective. Some like heavier keys while people like myself prefer a lighter touch. Need to play a few pieces on different brands & models before deciding.
How long they last will depend upon the quality of the build in the first place; the age of the used instrument; the feistiness of the player you're buying it from; and, how frequently they've played the instrument.
I brought my MP7SE from a retired gentleman who also had a Yamaha PSR keyboard which he preferred anyway. The gentleman in question said the instrument was 11 months old (he had the paper work) and admitted to having hardly played his MP7SE, finding the piano action 'a bit too heavy' for him. He wanted to sell his MP7SE to fund the purchase of a Yamaha Genos. That made sense to me. It chimed with the physical sensation of playing the instrument, as the action still felt kind of stiff---like new instruments often do. The keys all felt even around each other e.g., for a particular octave, there were no notes which felt soft or different like they'd been more heavily used.
I always ask questions to ascertain the circumstances behind the sale etc. My first used purchase was from a university student. He purchased the piano for a project and the project was over (so he'd had it for 6 months). He wanted to buy a synth for his next project and needed to liquidate the MP7 to afford it.
These are the kind of things you want to hear when buying a used instrument, just like you want to hear that a used car you're thinking of purchasing has been mostly kept in the garage and only taken out once or twice a week to the shops by a gentle natured 80 year old. Of course, what's said has to fit the facts coming out of the test drive.