Optimize two sql sentences adding indices
If you're not interested in rows that aren't 255, you could use a filtered index:

CREATE INDEX ix255 ON Code (AggregationLevelId)
INCLUDE (Serial, CodeId) 
WHERE CommissioningFlag = 255;


This means it will only index the ones that have 255, in AggregationLevelId order, including the values of Serial and CodeId because you need to count/return those.

If you cannot (or do not want to) use a filtered index, try the following (as originally suggested in a comment):

CREATE INDEX pick_a_name_for_the_index
ON Code (CommissioningFlag, AggregationLevelId) 
INCLUDE (Serial, CodeId);