Here's the old standard "wisdom" regarding knee pain, unless you have arthritis or something..
If the pain is in the front of the knee, the kneecap or patella, this is an indication that your knee is "hyperflexing", that is bending too much. Your saddle height is too low, or too far forward.
If the pain is in the rear, then you're overextending, which is a sign that saddle height is too high, or the saddle too far back.
There are other possibilities, of course, but at your age incipient arthritis seems unlikely.