While longevity and build quality aren't exactly the same thing, they do tend to be related. But as others have mentioned, qualities to look for:
-Fit and finish: are the pieces that make up the keyboard put together well? Do they all fit properly? Think Mercedes S class interior compared to comparable age Ford Focus interior. There's nothing particularly WRONG with the interior of the Focus, but it's undeniable that the Mercedes looks and feels nicer, even if the materials are the "same" (plastic, leather, chrome, whatever).
-Feature robustness: if the keyboard has extra features, are they implemented in a robust, well thought out manner? As redpill said, consistency is important here.
There are many other factors, but I think those two are the most important. If the feature set is robustly implemented, and the fit and finish are of high quality, it clearly indicates a higher level of attention to detail, and by proxy, quality.
Then again, you have Model Ms and Model Fs still kicking around, nearly 30 years after they were introduced. Fully functional, if a little worn and dirty in some cases. Admittedly, sometimes work is necessary in order to restore them to full functionality, but I would make the argument that whether that work can be done at all is an indication of quality. High quality goods can be repaired, rather than requiring replacement when they have issues.