When とき modified by a past-tense verb , it refers to the time when or after the action is/was completed.
When I went to Tokyo, I studied Aikido.
The speaker had already arrived in Tokyo when they studied Aikido, so the first verb gets a -た ending. It is important to note that this is because the action is completed, not necessarily because it happened in the past. The same structure can be used for a general truth that doesn’t happen at any specific time, for example:
When I’ve eaten a hot curry, I eat ice cream.
Note that this “completed tense” construction only works with verbs. Adjectives and nouns are always in the present tense when they modify とき.