You have to define your requirements a little bit more. What if the voltage is above the threshold for X amount of seconds after you turn on the motor? What if that X amount of seconds are greater than the interval you set? What if your threshold value changes during the motor on cycle, does the interval get updated immediately? Otherwise, the rest of it, code wise) is pretty trivial...
Read sensor values
Set interval based on first sensor
if second sensor value is greater than threshold
turn on motor
set the time the motor was turned on to now
if it's been a certain interval time since the motor was turned on
turn it off.