When exactly can you spend tokens?

By R22, in Star Wars: Armada

Is it any time during the associated ship's ship phase?

No, it's anytime that you could execute the corresponding Command. Afterall that is what spend tokens is.

In short Engineering and Squadron tokens can be spent right after you reveal your dial before you take your attacks. ConFire is spent during the modify attack dice step on the attack process. Navy is spent during determine course part of movement.

Check the RRG under Command.