When and Where to Step: Terrain-Aware Real-Time Footstep Location and Timing Optimization for Bipedal Robots