It depends on three factors:
1) the degree of tolerance to opioids
2) the degree of tolerance to benzos
3) the duration of action of the opioid in question
For instance if the opioid is something like methadone and the tolerance is low, the answer would be many, many hours. If the opioid is buprenorphine or something that doesn't impact respiration significantly (like tianeptine) and the tolerance is high, the answer would be whenever.
If you have a high tolerance to both you can take them at the same time (within the confines of those respective tolerances).
Without more information however this question is impossible (and dangerous) to answer.