def WriteClientCrashInfo(self, client_id, crash_info, cursor=None):
    """Writes a new client crash record."""
    query = """
    SET @now = NOW(6);

    INSERT INTO client_crash_history (client_id, timestamp, crash_info)
         VALUES (%(client_id)s, @now, %(crash_info)s);

    UPDATE clients
       SET last_crash_timestamp = @now
     WHERE client_id = %(client_id)s
    """

    params = {
        "client_id": db_utils.ClientIDToInt(client_id),
        "crash_info": crash_info.SerializeToString(),
    }

    try:
      cursor.execute(query, params)
    except MySQLdb.IntegrityError as e:
      raise db.UnknownClientError(client_id, cause=e)