To stretch a stiff knee, many leg stretches will help! I personally try the “touch your toes” stretch and I also do this one stretch where I find a corner of two walls, lay down in parallel to one of the sides and bring my leg closest to the wall up so its laying on the wall, both legs in the shape of an L. These stretches have really helped to loosen my knees and I hope they will help you too!
If the pain is sharp or continues to get worse go to your doctor and have it looked at. Now having said that, stretching your calves, hamstrings and quads are the best. Side lunges help. Don’t not do step ups or squats because those movements use a great deal of tendons and ligaments which will increase the stiffness and soreness of your knees. Also try to use a pad when doing floor exercises so not to irritate the knee tendons on the hard surface.