Yes. Use the millis() function to record the start time. As you gather the data, check the current value of millis() against the recorded start value. When the current value minus the start time exceeds 2 minutes, stop recording. See the blink without delay example.
I am not sure what "then shut off" means.