I was mistaken, mixing up your problem with another I'm working on. Disregard n-1 and m-1.
There are no unmatched durations if all per-materialID durations in the location table have matches in the material table, and vice-versa.
One way to find the materialIDs that have unmatched durations is to run exclusion joins in both directions ...
select distinct materialID
from (
select l.materialID
from location l
left join material m using(materialID,duration)
where m.materialID is null
union
select m.materialID
from material m
left join location l using(materialID,duration)
where l.materialID is null
) x;
(Look up exclusion joins if the above seems befuddling.)
Then to collect all durations for nonmatching materialIDs, save the above result so it can be joined to a query that fetches the materialIDs ...
drop table if exists t;
create table t
select distinct materialID
from (
select l.materialID
from location l
left join material m using(materialID,duration)
where m.materialID is null
union distinct
select m.materialID
from material m
left join location l using(materialID,duration)
where l.materialID is null
) x;
select data.materialID, group_concat(data.duration)
from (
select materialID,duration from location
union
select materialID,location from material
) as data
join t using(materialID)
group by data.materialID;
The two steps can be merged into one (cumbersome) query, but it's best to expose logic before efficiencies are sought.