とき: timing two events
とき means 'when,' but a verb's non-past or ta-form can change the timing relationship. Distinguish the sentence's past reference from completion relative to another event.
Connect each word class correctly
子どものとき means when someone was a child; 暇なとき means when someone is free; 忙しいとき means when someone is busy. Nouns take の, な-adjectives take な, and い-adjectives connect directly.
Verbs connect in plain forms such as 行くとき and 行ったとき, not 行きますとき. The main sentence can still end politely with a form such as 行きます or 買いました.
Before or after reaching a place
日本へ行くとき、空港で本を買いました。 says that the speaker bought a book at the airport when going to Japan. The purchase is placed before completion of the trip to Japan or during that process.
日本へ行ったとき、本を買いました。 says that the speaker bought a book when they went to Japan. It refers to the occasion of the visit; 行った does not imply that the purchase happened only after returning home.
Read the time of the whole sentence
今度、日本へ行ったとき、友達に会います。 can describe a future plan: meeting a friend on the next visit to Japan. The ta-form before とき does not mean that the visit has already happened.
Do not reduce every とき sentence to one rule. Consider whether the preceding predicate describes a state or an event with an endpoint, then compare when that situation holds with the timing of the main event.
Check: Must 日本へ行ったとき、写真を撮ります。 describe photographs already taken in the past?
Show the answer and why
No. In context, it can describe taking photographs on a future visit to Japan. 行った establishes timing inside the とき clause, not the past tense of the whole sentence.

