Make sure we never have a negative expiration value in setex call

Fix issue with setex being invalid in expire

Fixed condition