Fixed TTL in database.

Database no longer saves time of creation but time of expiry.
Fixed countdown functions to take account of this.