Refactor stats snapshot active record queries

Use more active record hash conditions and less sql string snippets

Using symbols instead of strings for created_at queries. This produces:
  `SELECT * FROM comments ORDER BY comments.created_at DESC`
  as opposed to:
  `SELECT * FROM comments ORDER BY created_at DESC`
which helps when joining to other tables that also have a created_at column

Simplify iso8601 time formatting method