Knees are kinda a weird joint. You've got several strong muscles all meeting at the same place, and your thigh muscle is very strong.
I'm NOT a doc, but when I have knee pain it's often related to how poorly I've stretched. I now stretch at the beginning and end of every trail day.
I came back from a 30 miler (over a long weekend) and my one knee was in great pain. I swore I'd screwed it up, and went into Medical to see the doc. The warrant officer had me do a stretch, and the pain was instantly gone.
Along with RICEing your knee, try a quadriceps stretch and a standing hamstring stretch.
The graphic midway down this page shows you what I mean by those terms.
LINK When the warrant had me stretch my knee using the standing hamstring stretch, he had me place my hands directly above my knee, touching the kneecap, and only wanted me to lean forward - not so I was stretching my back, just so I stretched the leg. I think my heel was up on a step stool or a trash can.
My thigh wasn't even warmed up, though that can help too if the pain's root cause is muscular.
Your mileage will vary. A professional trainer or a physical therapist, not a hack like me, will help a lot more than I can. Sorry if I was long winded.