From what you describe, my guess would be a mild case of IT Band syndrome. A tight IT Band (which runs from your hip down to your tibia) will cause slight maltracking of the kneecap; you say you're experiencing pain on the lateral part of your knee, which is right where the band inserts, and any flexion of the knee will cause further aggravation as your kneecap will continue to maltrack. Let it rest and get foam rolling, to see if that helps things ease up. With training, it can be prevented from returning by focusing on improving hip motility, strenghtening your external rotators (glutes) and strenghtening your VMO (e.g. terminal knee extensions) which will prevent the kneecap being pulled laterally.