Update middleware.py

Changed from datetime objects to timestamps allowing the use of serializers.JSONSerializer for session serialization (as it's the default serialization since Django 1.6.x).
Probably faster as well.