Loop through the queue and for each item use the Work Queues VBO's Unlock Item action to unlock the item. Then, it will probably go to exception status. If so, go to the next item and do the same. If it doesn't go to Exception, then mark it as Exception now. After the loop finishes, use the Work Queues VBO's Delete Processed Items action to delete all of them. Keep in mind that this action will delete all items in the queue with Completed and Exception status. There is no need to loop through the queue to use this action.
The fact that you have items being worked in the queue and left in locked status indicates that your automation design is incorrect. After an item is worked, it should be marked as Completed or Exception before getting the next work item to process. Doing so will unlock the item. Make sure you're doing that in your main processing loop.