Fix some errors with Python2.6 and Python3

For Python2.6: fix non-existing total_seconds by converting datetime
delta to seconds.

For Python3: fix "datetime is not JSON serializable" issue by converting
the delta datetime to unix timestamp first.
See if we really need jwt_payload_handler to return exp in unix seconds