SW-801: fixed sql code to resolve bug SW-801. resource_usages arn't lost anymore when updating the start/endtimes with the same start/endtimes