I have made this function I have checked and it worked fine
function make_item_inactive_expired()
{
$todayDate = date('Y-m-j');
Item::newInstance()->dao->query(sprintf("UPDATE %st_item SET b_active = 0 WHERE dt_expiration < '$todayDate' && b_premium = 0", DB_TABLE_PREFIX));
}
osc_add_hook('cron_daily', 'make_item_inactive_expired'); //to run it daily
osc_add_hook('cron_hourly', 'make_item_inactive_expired'); //to run it hourly