Hello Ria,
I think you could accomplish that with the Scheduler instead of the trigger, not sure if it would work in triggers.
Regarding what you said “only if the last contact was by the agent” i am not sure if it would work like that, since even if the last contact is made from a customer, the conditions could still be fulfilled. You may create a trigger also to update the state of a ticket from “Pending Reminder” to “open” when a customer updates the ticket to avoid this issue.