Let the escalator moves x steps when A walks down 60 steps. Total number of steps on a stationary escalator = x + 60.
When A takes 60 steps, B should have taken 30 steps and the escalator x steps. So when B takes 40 steps, the escalator should have taken 43×x steps.
So, 43×x+40 = x + 60 = Total number of steps in the escalator when it is stationary. So x = 60. Hence, total number of steps = 120