[時「とき」] => At the time A N5
Time
と同時に => at the same time as; while; simultaneously ~ N2
に代わって => instead of; replacing; on behalf of ~ N3
Vた[時「とき」] => After having done something N5
Time
代わりに => instead of; as a substitute for​; in exchange for; in return for N3
[代「か」]わり => Not A, but B, B in place of A, Instead of A, B; In exchange for A, B N3
Comparison, Exchange