If I can restate your question, you have ONE private IP, 40 public IPs, and you need each “session” to take one of those IPs. Does this mean you have 40 internal clients?
Point is, if you need a client on the private side that needs to stick to one of the 40 public IPs, there has to be something unique about that client. A “session” in this case could be a browser cookie, user identity, etc.