Accelerate status queries.

Construct a single SQL query to update the database row.
8x / 17x speedup for controller / device status queries.