Optimal Inference in Dynamic Models with Conditional Moment Restrictions