I don't think you can. The On Before Request is called before the request is called, so at that point you don't know whether the call will fail because of an expired token.
Also, using the On After Response won't help, as you can't retry the call from there.