Even amongst the most acclaimed homebrewers there are differences of opinions about when mash pH should be measured and what reading is best. However, to compare your findings with those advised in recognised technical texts, the sample should be cool. Any reading taken at mash temperature will be quoted as such.
If possible recycle your wort before taking a sample. A small sample swirled in a heavy glass container taken from a freezer will be quickly cooled. When at 20C the sample can be transferred to a small plastic container at 20C for measurement of pH.
You may find that early readings can be misleading, although worth recording for future guidance. As the mash procedes, pH will begin to stabilise. pH readings of runnings are critical and if allowed to rise above pH 5.6, risk extracting components that are better left in the mash tun.