select xx from tablexx where type in (1,3) and last<current-interval 30 second;
select xx from tablexx where type=1;
If create index on (type,last),the first one won't use index.
If create index on (last,type),the second one won't use index.
As for data type,which is can be seen from the example,type: int unsigned,last: datetime