There are several ways to do this, it just depends on exactly what you’re trying to accomplish.
If you want this to happen every single time the switch is turned on, use the power allowance option in the official smartlights feature. That’s what it’s for.
If you want to be able to sometimes have the light turn off on a timer and other times not, you can create a virtual timer. See the how to article in the community – created wiki. (This article will also show you how the power allowance feature works.).
http://thingsthataresmart.wiki/index.php?title=How_to_create_a_virtual_timer_for_a_light
If you want to do something more complicated, like have it turn on with the motion sensor and usually turn off with the timer, but if someone manually flips the switch have the lights stay on longer, the easiest way is to use core. You can think of core as a scripting language for SmartThings.