Look for obvious signs of damage and/or mistreatment. Otherwise, broken firing pins are about the only thing that happens to these rifles. I am approaching 20,000 rounds through mine and friends who shoot with me are in the 50,000+ round range with no obvious problems. No obvious wear in the barrel and if factory firing pins are used, no chamber damage. Some aftermarket firing pins can ding the chamber when dry fired. Firing pins last about 15,000 rounds before breaking.
In 2019 S&W had a recall on M&P 15-22s for an issue that could cause the bolt closing to set off a round. You could ask if the current owner is aware of the recall and if any action was taken. S&W shipped me the inspection gauge for free back when the recall first started, they may still do so.
The link below has more info, along with the inspection procedure for it.