Adaptive rotating-wave approximation for driven open quantum systems