WHERE t.PROC_INST_ID_ = ( SELECT DISTINCT te.proc_inst_id_ proc_inst_id FROM act_hi_taskinst_extension te WHERE te.BUSINESS_KEY_ = ? AND te.kind_id_ = 'task' AND te.TASK_DEF_KEY_ = 'Apply' )
AND t.TASK_DEF_KEY_ = 'Apply' ORDER BY t.START_TIME_ desc LIMIT 1