You can do like that:
No expiration limit is set in the cookie. But keep a unix_time value in the cookie. When each time you check the cookie, check that unix_time value and compare with your server current time, if the value indicates expiry. Clear the cookie and show out it's expired.
e.g.
to set cookie:
setcookie("expire_at", time()+1800); // 30 minutes
to check cookie:
if ($GLOBALS["expire_at"] < time()) {
// expired
setcookie("expire_at", "");
// continue for expiry
} else {
// not expire
// update the cookie if you want to update expiry time
}
Try it.