We want to delete the applications which are not in use from last 3 months, in other words whose key/secret is not used to generate access token in last 3 months.
Portal 5.x
There is no last use date logged for the APIkey's and tokens which are created are cleaned up when they expire so this data is not available as alternative the Portal analytics part may help to get some insight when a application was used .
Have a look at the portal API for metrics , there is API to collect application usage hits based on time frame . this may work to get the info on when this application was used in the past .