Just search this forum for “motion and timer” and you will find plenty examples, solutions, misfits etc… As a starter you can use this nice clean example, that shows the principle how to keep the lights on when motion is detected again: