Output timer with reset

I am looking to control some lights and cameras with some remote sensors.
If any of the sensors are triggered, I want the lights to come on and a signal sent to the camera to record.
I want the lights to remain on for 3 minutes and have the inputs monitored during that time so if the same or another input is triggered during that time, it will reset the timer and give it another 3 minutes until the timer runs out with no further trigger.
I know the "delay" in my code below will tie up the system and not monitor the inputs.
Please let me know how I can change the below to get the results I am looking for.
For the camera output pin, I only need a momentary trigger and it would be helpful if that could have maybe a 30 second timer to allow another input to trigger the camera again even while the lights output is still active.

Thank you for any help you can provide.
Larry

int pgate = 8;
int gate1 = 9;
int gate2 = 10;
int gate3 = 11;
int entrance = 12;
int lights = 4;
int camera = 5;

void setup() {
pinMode(pgate, INPUT);
pinMode(gate1, INPUT);
pinMode(gate2, INPUT);
pinMode(gate3, INPUT);
pinMode(entrance, INPUT);
pinMode(lights, OUTPUT);
pinMode(camera, OUTPUT);
}

void loop()
{
if(digitalRead(pgate) == LOW ||
digitalRead(gate1) == LOW ||
digitalRead(gate2) == LOW ||
digitalRead(gate3) == LOW ||
digitalRead(entrance) == LOW)
{
digitalWrite(lights, HIGH);
digitalWrite(camera, HIGH);
delay(180000);
digitalWrite(lights, LOW);
digitalWrite(camera, LOW);
}
else
{
digitalWrite(lights, LOW);
digitalWrite(camera, LOW);
}
}

Please let me know how I can change the below to get the results I am looking for.

The blink without delay example has all the details.

Please use code tags. Use the </> icon in the posting menu. [code] Paste sketch here. [/code]

Format your code with CRTL T

.