例)有効期限内と期限切れそれぞれの件数を1SQLで求めたい
mysql> select (expires_at < now()) expired, count(\*) from token group by (expires_at < now());
+---------+----------+
| expired | count(*) |
+---------+----------+
| 0 | 57824 | ※期限内
| 1 | 271056 | ※期限切れ
+---------+----------+
2 rows in set (0.14 sec)