Secure session handling in PHP
As an overarching rule, I never write scripts with the "stfu operator" (@). It looks like you plan to refine the session starting line, so I won't dwell.
You are calling time() 5 separate times in your function.  Because there is no benefit in recording their differences in terms of microseconds, I recommend that you call time() once, and cache the value in a variable/constant to be used in all processes in the custom function.
I tend to never use OR or AND in my php conditions (only in my SQL) as a matter of consistency.  This also prevents unintended hiccups regarding precedence.  Separately, I never use or die() in my scripts ...trying not to dwell.
Because you are generating a hash for non-cryptographic use, you may enjoy the advice/discussions about performance comparisons between different hash generators: Fastest hash for non-cryptographic uses?