As Kokulan suggested, create a CWA to check if there other waiting workflows.
I used the below code to retrieve the waiting workflows from the entity asyncoperation and cancelled these instances. As input parameter, I passed the workflow to be fetched.
You can change it as per your need.
Entity workflowReq = service.Retrieve("workflow", Workflow.Get<EntityReference>(executionContext).Id, new ColumnSet(new string[] { "name" }));
QueryExpression query = new QueryExpression("asyncoperation");
ColumnSet cols = new ColumnSet(new string[] { "asyncoperationid", "statecode" });
//create conditions
ConditionExpression c1 = new ConditionExpression("workflowactivationidname", ConditionOperator.Equal, workflowReq.Attributes["name"].ToString()); // Guid of the workflow -input property
ConditionExpression c2 = new ConditionExpression("regardingobjectid", ConditionOperator.Equal, context.PrimaryEntityId);// entity id
ConditionExpression c3 = new ConditionExpression("statecode", ConditionOperator.Equal, 1);//statecode Waiting
//ConditionExpression c3 = new ConditionExpression("statuscode", ConditionOperator.In, new int[] { 0, 10, 21, 20 });//statuscode Waiting, Waiting For Resources, Pausing and In Progress
//create the filter
FilterExpression filter = new FilterExpression();
filter.FilterOperator = LogicalOperator.And;
filter.AddCondition(c1);
filter.AddCondition(c2);
filter.AddCondition(c3);
query.ColumnSet = cols;
query.Criteria.AddFilter(filter);
//get the collection of results
EntityCollection colResults = service.RetrieveMultiple(query);
foreach (Entity async in colResults.Entities)
{
Entity e = async;
//change the status of the system job
e["statecode"] = new OptionSetValue(3); //cancelled
//update the object
service.Update(e);
}