Signal low delay for specific amount of time / hardware - equivalent of Arduino pulseIn() function
You only need one trigger point to be defined, you don't need upper and lower boundaries defined.
For your application any signal 40ms and longer creates an output and less than 40ms creates no output.

The circuit below is just an example of what you might do using conventional logic:



The logic is as follows:


U1A provides a high or low signal to the shift register on its inputs A, B. If the photo transistor in illuminated, then the input to the shift register is low. 
U1B provides a clear signal to the shift register (U2) when powered up and sets all the shift register outputs to zero.
With all the outputs zero the *Output of U3 is high.
U4 is a 200Hz oscillator. (this could be a 555 astable if you like) The oscillator clocks  the value of the A, B shift register inputs through the Q outputs.
For any high (inputs A, B) input values below 40ms there will always be at least one zero bit in the shift register, so the *Output will always be high. If the input signal extends beyond 40ms then for at least one clock period the *Output will be low.


While this logic should work (I have neither simulated or built this), the task would be much better accomplished using a small single chip MCU.